import React, { useState, useEffect } from 'react'
import { NavBar } from 'antd-mobile'
import { useNavigate } from 'react-router-dom'
import axios from 'axios'
import style from './index.module.scss'
const Index: React.FC = () => {
    const navigate = useNavigate()
    const [list, setList] = useState([])
    const [currentPage, setCurrentPage] = useState(1);
    const [pageSize, setPageSize] = useState(10);
    const getlist = async () => {
        const res = await axios.get('/api/date', {
            params: {
                currentPage,
                pageSize
            }
        })
        setList(res.data.data)
        console.log(res.data.data);

    }
    useEffect(() => {
        getlist()
    }, [])
    return (
        <div>
            <NavBar onBack={() => navigate(-1)}>好大夫在线</NavBar>
            <div>
                <img className={style.topimg} src='../../src/img/sanjia.png' alt="" />
            </div>
            <div>
                {
                    list.length > 0 && list.map((item: any, index) => {
                        return <div key={index} className={style.box}>
                            <div className={style.fdbox}>
                                <img src={item.image} alt="" />
                                <div>
                                    <p>{item.name}</p>
                                    <p>{item.type}</p>
                                    <p> {item.address}&nbsp;{item.keshi}</p>
                                   
                                </div>
                            </div>
                            <div className={style.desc}>
                                {item.shanc}
                            </div>
                        </div>
                    })
                }
            </div>
        </div>
    )
}

export default Index
